package com.lp.controller;

import com.lp.config.AppReturn;
import com.lp.config.CodeMsg;
import com.lp.exception.ApplicationException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    @Value("${server.port}")
    private Integer port;

    @GetMapping("/get")
    public String user(String name) {
        System.out.println("拿到网关过滤器添加的参数：name=" + name);
        throw new ApplicationException(AppReturn.fail(CodeMsg.FAIL));
//        return "user ok! port=" + port;
    }

    @GetMapping("/test")
    public String test() {
        return "这个数据需要被统一返回类型处理";
    }


}
